home *** CD-ROM | disk | FTP | other *** search
/ Get a Grip Tennis by Wilson / Get a Grip Tennis by Wilson.iso / pc / wilson.dxr / Internal_27_horizontal animator.ls < prev    next >
Encoding:
Text File  |  2003-08-12  |  832 b   |  37 lines

  1. property pSprite, pStart, pEnd, pDir, pDistance, pRate
  2.  
  3. on beginSprite me
  4.   pSprite = sprite(the currentSpriteNum)
  5.   pStart = pSprite.locH
  6.   pEnd = pStart + pDistance
  7.   pDir = 1
  8.   add(the actorList, pSprite)
  9. end
  10.  
  11. on stepFrame me
  12.   curLoc = pSprite.locH
  13.   if curLoc > pEnd then
  14.     pDir = 0
  15.   else
  16.     if curLoc < pStart then
  17.       pDir = 1
  18.     end if
  19.   end if
  20.   if pDir then
  21.     pSprite.locH = curLoc + pRate
  22.   else
  23.     pSprite.locH = curLoc - pRate
  24.   end if
  25. end
  26.  
  27. on endSprite me
  28.   (the actorList).deleteOne(pSprite)
  29. end
  30.  
  31. on getPropertyDescriptionList
  32.   pList = [:]
  33.   addProp(pList, #pDistance, [#comment: "move distance: ", #format: #integer, #default: 30, #range: [#min: 0, #max: 800]])
  34.   addProp(pList, #pRate, [#comment: "rate (pix per frame): ", #format: #integer, #default: 2, #range: [#min: 1, #max: 20]])
  35.   return pList
  36. end
  37.